package com.ibm.cps.parsers;

import java.util.Collection;
import java.util.HashMap;

import com.ibm.util.exception.CPSException;

@Deprecated
public abstract class MessageParser<T> {

	public static MessageParser getParserInstance() {
		return JsonMessageParser.getMessageParser();
	}

	abstract public Collection<T> parse(String input) throws CPSException;

	abstract public String getStringField(T input, String field)
			throws CPSException;

	abstract public Collection<String> getArrayField(T input, String field);

	abstract public String getNoExceptionStringField(T input, String field)
			throws CPSException;

	abstract public int getIntField(T input, String field) throws CPSException;

	abstract public boolean hasStringField(T input, String field)
			throws CPSException;

	abstract public HashMap<String, String> getKeyValue(String input)
			throws CPSException;

	abstract public boolean isStringField(T object, String fieldName)
			throws CPSException;

	abstract public boolean isIntField(T object, String fieldName)
			throws CPSException;

	abstract public boolean isBooleanField(T object, String fieldName)
			throws CPSException;

	abstract public boolean isArrayField(T object, String fieldName)
			throws CPSException;

	public String convert2String(T ele) {
		return ele.toString();
	}

	abstract public void setStringField(T element, String field, String value);

	abstract public void setArrayField(T element, String field, String... value);

	abstract public void removeField(T element, String field);
}
